{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "m37qHIlAq_UH"
   },
   "source": [
    "#NAME:  firstName lastName\n",
    "##Please replace \"firstName\" and \"lastName\" with yours."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "yX9VnK0Xqdau"
   },
   "source": [
    "#COSC 2347 - \n",
    "##NOTE:\n",
    "1.   First, please write down your name (first_name & last_name) in the text cell provided above.\n",
    "2.   You are asked to answer the total of 50 questions plus one bonus question.\n",
    "3.   Please add your answer, implementation, or explanation either in a text cell or in a code cell as required/directed/specified for each question.\n",
    "4.   Also, please copy down your answer, code, or explanation on the answer-sheet provided in the Blackboard.\n",
    "5.   You are welcome to add other code and/or text cells, keeping track of the whole steps of your practice.\n",
    "6.   However, please do not change the given code or statements unless otherwise you are asked to do.\n",
    "7.   Finally, please turn in **both this ipynb file and the MS Word file by 9:00 AM, Friday, Nov. 5.**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kntD-DlLjWuF"
   },
   "source": [
    "##Let's get started!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "zNP07YRqglVQ"
   },
   "source": [
    "##Please refer to the code (below) for Q01 - Q20."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "CQGXfwi8tAk0"
   },
   "outputs": [],
   "source": [
    "class COSC1437:\n",
    "    '''COSC1437: Programming Fundamentals II'''\n",
    "    x = 10\n",
    "    def _init_(self, semester, year):\n",
    "        self.semester = semester\n",
    "        self.year = year\n",
    "\n",
    "    def display1(self):\n",
    "        print('COSC1437: Programming Fundamentals II')\n",
    "        print(\"Semester:\",self.semester,\"\\nYear: \",self.year)\n",
    "    \n",
    "    def display2(self):\n",
    "         print(\"Semester: \" + self.semester + \"\\nYear\" +\"\",self.year)\n",
    "\n",
    "    def display3(self):\n",
    "        print(\"Semester: {} \\n Year: {}\".format(self.semester,self.year))\n",
    "    \n",
    "    def display4(self):\n",
    "        print(f\"Semester: {self.semester}\\nYear: {self.year}\")\n",
    "\n",
    "    def display5(self):\n",
    "         print(f\"Semester: {self.semester}\\\\nYear: {self.year}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "pqk03wvBmW9n"
   },
   "source": [
    "####(Q01) Write one-line code that print out the doc-string (of class COSC1437) as shown below.\n",
    "```\n",
    "'COSC1437: Programming Fundamentals II'\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "FZX__lH7ZFfu"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "COSC1437: Programming Fundamentals II\n"
     ]
    }
   ],
   "source": [
    "#ADD YOUR CODE IN THIS CODE CELL... \n",
    "\"\"\"COSC1437: Programming Fundamentals II\"\"\"\n",
    "COSC1437.display1('x')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "lUgLsMAvqxe1"
   },
   "source": [
    "####(Q02) Write one-line code that print out the doc-string (of class COSC1437) as shown below.\n",
    "```\n",
    "COSC1437: Programming Fundamentals II\n",
    "```**bold text**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "id": "ZVx6rHLEzW7a"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "COSC1437: Programming Fundamentals II\u001b[1m bold text\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "#ADD YOUR CODE IN THIS CODE CELL...\n",
    "\n",
    "COSC1437.display2('x')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "slZsRgRHrqmM"
   },
   "source": [
    "####(Q03) Implement the body of **display1(self)** method using **comma(,)** in COSC1437 class so that the statements in the code cell can print out the two lines as shown below.\n",
    "```\n",
    "Semester:  fall03 \n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "lWpoO_Kx0r7l"
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "COSC1437() takes no arguments",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-28-fef2dc1fea3f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m#AFTER IMPLEMENTING display1(self) in COSC1437, RUN THIS CODE CELL...\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mi1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mCOSC1437\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"fall03\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m2021\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      3\u001b[0m \u001b[0mi1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisplay1\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: COSC1437() takes no arguments"
     ]
    }
   ],
   "source": [
    "#AFTER IMPLEMENTING display1(self) in COSC1437, RUN THIS CODE CELL... \n",
    "i1 = COSC1437(\"fall03\", 2021)\n",
    "i1.display1()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "MzKFipPMuWhR"
   },
   "source": [
    "####(Q04) Implement the body of **display2(self)** method using **addition(+)** (i.e., concatenation) so that the statements in the code cell print out the two lines as shown below.\n",
    "```\n",
    "Semester:  fall04 \n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "id": "NCizpGgekwqx"
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "COSC1437() takes no arguments",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-29-faa590ea4b4d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m#AFTER IMPLEMENTING display2(self) in COSC1437 class, RUN THIS CODE CELL...\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mi1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mCOSC1437\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"fall04\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m2021\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      3\u001b[0m \u001b[0mi1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisplay2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: COSC1437() takes no arguments"
     ]
    }
   ],
   "source": [
    "#AFTER IMPLEMENTING display2(self) in COSC1437 class, RUN THIS CODE CELL... \n",
    "i1 = COSC1437(\"fall04\", 2021)\n",
    "i1.display2()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "gFoPNoKmw4WV"
   },
   "source": [
    "####(Q05) Implement the body of **display3(self)** method using **str.format()** so that the statements in the code cell can print out the two lines as shown below.\n",
    "```\n",
    "Semester:  fall05 \n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "id": "Q4PhrEQDhSQK"
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "COSC1437() takes no arguments",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-35-94d65b01e9ff>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0mi1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mCOSC1437\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"fall04\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m2021\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      5\u001b[0m \u001b[0mi1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisplay3\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: COSC1437() takes no arguments"
     ]
    }
   ],
   "source": [
    "#AFTER IMPLEMENTING display3(self) in COSC1437 class, RUN THIS CODE CELL... \n",
    "\n",
    "\n",
    "i1 = COSC1437(\"fall04\", 2021)\n",
    "i1.display3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "8yVFscaWxXoP"
   },
   "source": [
    "####(Q06) Implement the body of **display4(self)** method using **f-string** so that the statements in the code cell can print out the two lines as shown below.\n",
    "```\n",
    "Semester:  fall06 \n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "nhNmVIqfh6gW"
   },
   "outputs": [],
   "source": [
    "#AFTER IMPLEMENTING display4(self) in COSC1437 class, RUN THIS CODE CELL... \n",
    "i1 = COSC1437(\"fall06\", 2021)\n",
    "i1.display4()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "x_44Wtzbxa06"
   },
   "source": [
    "####(Q07) Implement the body of **display5(self)** method that can return a string using **f-string** in a specific format. For example, the statements in the code cell below should print out the one string as shown below.\n",
    "```\n",
    "'Semester: fall07\\nYear:     2021'\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "EvPwfIALkCuo"
   },
   "outputs": [],
   "source": [
    "#AFTER IMPLEMENTING display5(self) in COSC1437 class, RUN THIS CODE CELL... \n",
    "i1 = COSC1437(\"fall07\", 2021)\n",
    "i1.display5()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "906gmw2r2VC8"
   },
   "source": [
    "####(Q08) Revise one of the statements in the code cell so that it can print out the contents as shown below.\n",
    "```\n",
    "Semester: fall08\n",
    "Year:     2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "id": "niBjMh90m2cc"
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "COSC1437() takes no arguments",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-32-ebb182cd28b3>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m#AFTER REVISING one of the two statements, RUN THIS CODE CELL...\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mi1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mCOSC1437\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"fall08\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m2021\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      3\u001b[0m \u001b[0mil\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisplay5\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: COSC1437() takes no arguments"
     ]
    }
   ],
   "source": [
    "#AFTER REVISING one of the two statements, RUN THIS CODE CELL...\n",
    "i1 = COSC1437(\"fall08\", 2021)\n",
    "il.display5()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "WJDwU8Ep3o-2"
   },
   "source": [
    "####(Q09) Try to execute (i.e., run) the statement in the code cell and then  explain why it has a TypeError or an AttributeError.\n",
    "*   (YOUR ANSWER) It is because...\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "id": "REMi2NG3CqiK"
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "display1() missing 1 required positional argument: 'self'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-33-635d63287154>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m#RUN THIS CODE CELL...\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mCOSC1437\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdisplay1\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: display1() missing 1 required positional argument: 'self'"
     ]
    }
   ],
   "source": [
    "#RUN THIS CODE CELL...\n",
    "COSC1437.display1()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "bVUQQm8O5XTj"
   },
   "source": [
    "####(Q10) Try to execute (i.e., run) the statement in the code cell and then  explain why it has a TypeError or an AttributeError.\n",
    "*   (YOUR ANSWER) It is because...\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "vAwmXmZ7Z7j1"
   },
   "outputs": [],
   "source": [
    "#RUN THIS CODE CELL...\n",
    "COSC1437.display1(COSC1437)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "oRiZS39t5jAV"
   },
   "source": [
    "####(Q11) Explain why the third statement in the code cell has a error.\n",
    "*   (YOUR ANSWER) It is because...\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "hWGRTyy1wpa2"
   },
   "outputs": [],
   "source": [
    "#FIRST, RUN THIS CODE CELL and ANSWER THE QUESTION ABOVE...\n",
    "i1 = COSC1437\n",
    "COSC1437.__init__(i1, \"fall11\", \"2021\")\n",
    "i1.display1()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "1Rtat_2W69YG"
   },
   "source": [
    "####(Q12) Revise **i1 = COSC1437** in the code cell so that the whole code in the code cell can print out the two line as shown below.\n",
    "```\n",
    "Semester:  fall12 \n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "0XSjezyOrqUl"
   },
   "outputs": [],
   "source": [
    "#FIRST, RUN THIS CODE CELL and REVISE THE CODE LINE AS REQUESTED ABOVE...\n",
    "if hasattr(COSC1437, \"semester\"): \n",
    "    delattr(COSC1437, \"semester\")     #It is needed because of (Q10)\n",
    "if hasattr(COSC1437, \"year\"):\n",
    "    delattr(COSC1437, \"year\")         #It is needed because of (Q10)\n",
    "\n",
    "i1 = COSC1437         # YOU ARE ASKED TO REVISE THIS LINE...\n",
    "\n",
    "COSC1437.__init__(i1, \"fall12\", \"2021\")\n",
    "i1.display1()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "Pp-7EcODEs-9"
   },
   "source": [
    "####(Q13) Explain why **il.__init__(\"fall8\", 2021)** has a TypeError.\n",
    "* (YOUR ANSWER) It is because..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "2XBRj_CTzyWj"
   },
   "outputs": [],
   "source": [
    "#RUN THIS CODE CELL, and ANSWER THE ABOVE QUESTION...\n",
    "i1 = COSC1437\n",
    "i1.__init__(\"fall13\", 2021)\n",
    "i1.display1()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "wsKNIM0nGi_h"
   },
   "source": [
    "####(Q14) Revise **i1 = COSC1437** so that the statements in the code cell can print out the contents as shown below.\n",
    "```\n",
    "Semester:  fall14 \n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "k5yPLEaPuWJG"
   },
   "outputs": [],
   "source": [
    "#AFTER REVISING THE FIRST STATEMENT, RUN THIS CODE CELL...\n",
    "i1 = COSC1437\n",
    "i1.__init__(\"fall14\", 2021)\n",
    "i1.display1()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "WEz5N-erHw-k"
   },
   "source": [
    "####(Q15) Explain why both the two statements below have AttributeError?\n",
    "* (YOUR ANSWER) It is because..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "PminOGN5v4wE"
   },
   "outputs": [],
   "source": [
    "#RUN THIS CODE CELL and ANSWER THE QUESTION ABOVE...\n",
    "print(COSC1437.semester)\n",
    "print(COSC1437.year)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "HMfsHr09IMFV"
   },
   "source": [
    "####(Q16) Add one new statement so that the three statements in the code cell print out what is shown below.\n",
    "```\n",
    "fall16\n",
    "2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "I5sJThT0v08o"
   },
   "outputs": [],
   "source": [
    "#INSERT A NEW STATEMENT AS THE FIRST CODE LINE and RUN THE CODE CELL...\n",
    "\n",
    "print(COSC1437.semester)\n",
    "print(COSC1437.year)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "vC8YFlFPJOS_"
   },
   "source": [
    "####(Q17) After you correctly answer (Q16), write one statement that uses/calls **display1(self)** so that it can print out what is shown below.\n",
    "```\n",
    "Semester:  fall16\n",
    "Year:      2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "F3GuQHLtxA5p"
   },
   "outputs": [],
   "source": [
    "#ADD ONE LINE CODE THAT CALLS display1(self) and RUN THIS CODE CELL...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "JkPwmx5xKI0N"
   },
   "source": [
    "####(Q18) If you add **another *display1(self)* method** (shown in the code cell below) at the end of COSC1437 class, then what will happen for the previous questions that called display1() method? \n",
    "* (YOUR ANSWER) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "JfGxNpEUxzCM"
   },
   "outputs": [],
   "source": [
    "#ADD THIS NEW display1(self) AS THE LAST METHOD OF COSC1437 class and ANSWER THE QUESTION ABOVE...\n",
    "def display1(self):\n",
    "    print(\"This is the second display1(self).\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "bUfONeA1Lyrv"
   },
   "source": [
    "####(Q19) What are the differences between i1 and i2 in the code cell?\n",
    "* (YOUR ANSWER) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "C1OAWyhf0m_e"
   },
   "outputs": [],
   "source": [
    "#RUN THIS CODE CELL and ANSWER THE QUESTION ABOVE...\n",
    "i1 = COSC1437(\"fall19\", 2021)\n",
    "i2 = COSC1437\n",
    "print(i1)\n",
    "print(i2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "7jshPnpLMhjq"
   },
   "source": [
    "####(Q20) What does **display4(self)** return? Explain why it returns the specific value.\n",
    "* (YOUR ANSWER)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "morcSEG23EtQ"
   },
   "outputs": [],
   "source": [
    "#RUN THIS CODE CELL and ANSWER THE QUESTION ABOVE...\n",
    "i1 = COSC1437(\"fall20\", 2021)\n",
    "temp = i1.display4()\n",
    "print(temp)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "tNdFp-Zrgvp0"
   },
   "source": [
    "##Please refer to the code (below) for Q21 - Q26."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "FBuElnV80MqE"
   },
   "outputs": [],
   "source": [
    "class COSC1437:\n",
    "    'COSC1437: Programming Fundamentals II'\n",
    "\n",
    "    semester = \"FALL 2021\"\n",
    "\n",
    "   \n",
    "    def __init__(self, semester):\n",
    "        self.semester = semester\n",
    "\n",
    "    def display1(self):\n",
    "        print(f\"Semester: {self.semester}\")\n",
    "\n",
    "    @classmethod\n",
    "    def display2(cls):\n",
    "        print(f\"Semester: {cls.semester}\")\n",
    "\n",
    "    @staticmethod\n",
    "    def display3(semester):\n",
    "        print(f\"Semester: {semester}\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "-7E8uXY6NFTe"
   },
   "source": [
    "####(Q21) How to check out the specific type of all the function(s)/method(s) in COSC1437? Write a for loop that shows the dictionary contents that include COSC1437's symbol table."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "FSUwthqgA8gI"
   },
   "outputs": [],
   "source": [
    "##WRITE DOWN A FOR LOOP THAT ADDRESS THE QUESTION ABOVE...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "va8a4l4QNitF"
   },
   "source": [
    "####(Q22) Write down a typical usage of the instance method (i.e., **display1(self)**) so that it can print out the content (shown below).\n",
    "```\n",
    "Semester: fall22 2021```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "pqgR1IRQAs49"
   },
   "outputs": [],
   "source": [
    "##WRITE DOWN TWO STATEMENT(S) THAT ADDRESS THE QUESTION ABOVE...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "dfVqzymMOFQS"
   },
   "source": [
    "####(Q23) Write down a typical usage of the class method (i.e., **display2(cls)**) so that it can print out the content (shown below).\n",
    "```\n",
    "Semester: FALL 2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "cVak4u-KEOtz"
   },
   "outputs": [],
   "source": [
    "#WRITE DOWN ONE STATEMENT THAT ADDRESSES THE QUESTION ABOVE...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4lJuxQYUPAdq"
   },
   "source": [
    "####(Q24) Write down a typical usage of the static method (i.e., **display3(semester)**) so that it can print out the content (shown below).\n",
    "```\n",
    "Semester: Fall24 2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "s4kATFW_EZVX"
   },
   "outputs": [],
   "source": [
    "#WRITE DOEN ONE STATEMENT THAT ADDRESSES THE QUESTION ABOVE...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "r6mMwIBRQVYM"
   },
   "source": [
    "####(Q25) Show an usage of __init__(self, semester) directly (i.e., explicitly) with classname (i.e., **COSC1437.__init__(...)**) with a couple of statements so that the whole statements can print out the content (shown below).\n",
    "```\n",
    "Semester: fall25 2021\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "sOVpCKnV2DqA"
   },
   "outputs": [],
   "source": [
    "#MAKE AN INSTANCE, CALL __init__(self, semester) EXPLICTLY WITH COSC1437, and then CALL display1().\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "QUs_r1YTRZaO"
   },
   "source": [
    "####(Q26) Show an usage of __init__(self, semester) directly (i.e., explicitly) with an instance (say i1) (i.e., **i1.__init__(...)**) with a couple of statements so that the whole statements can print out the content (shown below).\n",
    "```\n",
    "Semester: fall26 2021\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "Jsk34cJl_g0l"
   },
   "outputs": [],
   "source": [
    "#MAKE AN INSTANCE, CALL __init__(self, semester) WITH THE INSTANCE, and then CALL display1().\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "_kAta40Iz15z"
   },
   "source": [
    "##Please refer to the code (below) for Q27 - Q40."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "_Zfdfk6Oz4li"
   },
   "outputs": [],
   "source": [
    "class Parent:\n",
    "    'Parent/super/base class'\n",
    "    \n",
    "    name = \"PARENT CLASS\"\n",
    "\n",
    "    def instance1():\n",
    "        print(\"%s instance1() called\" % Parent.name)\n",
    "    def instance2(self):\n",
    "        print(\"%s instance2(self) called\" % self.name)\n",
    "\n",
    "    @classmethod\n",
    "    def class1():\n",
    "        print(\"%s class1() called\" % Parent.name)\n",
    "    @classmethod\n",
    "    def class2(cls):\n",
    "        print(\"%s class2(cls) called\" % cls.name)\n",
    "\n",
    "    @staticmethod\n",
    "    def static1():\n",
    "        print(\"%s static1() called\" % Parent.name)\n",
    "    @staticmethod\n",
    "    def static2(cls):\n",
    "        print(\"%s static2(cls) called\" % cls.name)\n",
    "\n",
    "\n",
    "class Child(Parent):\n",
    "    'Child/sub/derived class'\n",
    "\n",
    "    name = \"CHILD CLASS\"\n",
    "\n",
    "    def instance3(self):\n",
    "        print(\"%s instance3() called\" % self.name)\n",
    "\n",
    "    @classmethod\n",
    "    def class3(cls):\n",
    "        print(\"%s class3(cls) called\" % cls.name)\n",
    "\n",
    "    @staticmethod\n",
    "    def static3(cls):\n",
    "        print(\"%s static3(cls) called\" % cls.name)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4_0I7GPUUj5b"
   },
   "source": [
    "####(Q27) How to check out the specific type of all the function(s)/method(s) in Parent? Write a for loop that shows the dictionary contents that include Parent's symbol table.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "NwKFHIAGFQwj"
   },
   "outputs": [],
   "source": [
    "##WRITE DOWN A FOR LOOP THAT ADDRESS THE QUESTION ABOVE...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "vxmmG4o8UrhT"
   },
   "source": [
    "####(Q28) How to check out the specific type of all the function(s)/method(s) in Child? Write a for loop that shows the dictionary contents that include Child's symbol table.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "lkOKHbCWhDC1"
   },
   "outputs": [],
   "source": [
    "##WRITE DOWN A FOR LOOP THAT ADDRESS THE QUESTION ABOVE...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "MpBEs3WpUySK"
   },
   "source": [
    "####(Q29) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "d3VVypPgjxjG"
   },
   "outputs": [],
   "source": [
    "Parent.instance1()\n",
    "Parent.instance2()\n",
    "Parent.instance3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "kuc1j_h-U5Sm"
   },
   "source": [
    "####(Q30) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "UYioq9OqkcZW"
   },
   "outputs": [],
   "source": [
    "i = Parent()    #DO NOT CHANGE THIS LINE...\n",
    "i.instance1()\n",
    "i.instance2()\n",
    "i.instance3()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "KxFYj8UDVAbU"
   },
   "source": [
    "####(Q31) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "M55dNzOHlHZ9"
   },
   "outputs": [],
   "source": [
    "Parent.class1()\n",
    "Parent.class2()\n",
    "Parent.class3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "NPIiGHhxVG2n"
   },
   "source": [
    "####(Q32) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "bZh348welea3"
   },
   "outputs": [],
   "source": [
    "i = Parent()      #DO NOT CHANGE THIS LINE...\n",
    "i.class1()\n",
    "i.class2()\n",
    "i.class3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "NIkUZ-zlVOmJ"
   },
   "source": [
    "####(Q33) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "q7SXxuxFl1Jc"
   },
   "outputs": [],
   "source": [
    "Parent.static1()\n",
    "Parent.static2()\n",
    "Parent.static3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "FA2OU3azVcZr"
   },
   "source": [
    "####(Q34) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "vIrtQxZtl09r"
   },
   "outputs": [],
   "source": [
    "i.static1()\n",
    "i.static2()\n",
    "i.static3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "xMLhqxReVTsO"
   },
   "source": [
    "####(Q35) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "s3VlUdGTm6S_"
   },
   "outputs": [],
   "source": [
    "Child.instance1()\n",
    "Child.instance2()\n",
    "Child.instance3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "okbTItqIVig4"
   },
   "source": [
    "####(Q36) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "sFZoW2J20k2X"
   },
   "outputs": [],
   "source": [
    "i = Child()       #DO NOT CHANGE THIS LINE...\n",
    "i.instance1()\n",
    "i.instance2()\n",
    "i.instance3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "3oUrdq3wVv0s"
   },
   "source": [
    "####(Q37) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "pMMFx8eioaQv"
   },
   "outputs": [],
   "source": [
    "Child.class1()\n",
    "Child.class2()\n",
    "Child.class3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "0leno4DwV3DX"
   },
   "source": [
    "####(Q38) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "WHGXJcxvpsBc"
   },
   "outputs": [],
   "source": [
    "i = Child()      #DO NOT CHANGE THIS LINE...\n",
    "i.class1()\n",
    "i.class2()\n",
    "i.class3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "miOeNDrOV8G0"
   },
   "source": [
    "####(Q39) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "B1W3tWoqo5ef"
   },
   "outputs": [],
   "source": [
    "Child.static1()\n",
    "Child.static2()\n",
    "Child.static3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "68vEJoVEWAq9"
   },
   "source": [
    "####(Q40) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "id": "Mh3E2sl5oiat"
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'Child' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-36-13855861d60d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mi\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mChild\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m       \u001b[1;31m#DO NOT CHANGE THIS LINE...\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      2\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstatic1\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstatic2\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstatic3\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name 'Child' is not defined"
     ]
    }
   ],
   "source": [
    "i = Child()       #DO NOT CHANGE THIS LINE...\n",
    "i.static1()\n",
    "i.static2()\n",
    "i.static3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "WKZ6uGSb0grI"
   },
   "source": [
    "##Please refer to the code (below) for Q41 - Q46."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "id": "7uHQtecEqPiD"
   },
   "outputs": [],
   "source": [
    "class Base:\n",
    "\n",
    "    def m1(self):\n",
    "        print(\"m1()\")\n",
    "    def _m2(self):\n",
    "        print(\"_m2()\")\n",
    "    def __m3(self):\n",
    "        print(\"__m3()\")\n",
    "\n",
    "\n",
    "class Derived(Base):\n",
    "\n",
    "    def __init__(self):\n",
    "        Base.__init__(self)\n",
    "\n",
    "    def call1(self):\n",
    "        self.m1()\n",
    "\t\t\n",
    "    def call2(self):\n",
    "        self._m2()\n",
    "\n",
    "    def call3(self):\n",
    "        self.__m3()\n",
    "        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ITV_Rec7WQhD"
   },
   "source": [
    "####(Q41) How to get the information on attributes and methods of Derived? Write one statement that shows the list of attributes and methods of Derived.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "id": "1uDnVlLfDQpm"
   },
   "outputs": [],
   "source": [
    "#WRITE DOWN ONE STATEMENT and RUN THIS CODE CELL...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "7Es4nHFcWXmA"
   },
   "source": [
    "####(Q42) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line. \n",
    "* Make sure that the final output of the commend cell should be as follows.\n",
    "```\n",
    "m1()\n",
    "_m2()\n",
    "__m3()\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "UPtY7iBL6AsV"
   },
   "outputs": [],
   "source": [
    "Base.m1()\n",
    "Base._m2()\n",
    "Base.__m3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "Y2sBpaQaWdhP"
   },
   "source": [
    "####(Q43) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n",
    "* Make sure that the final output of the commend cell should be as follows.\n",
    "```\n",
    "m1()\n",
    "_m2()\n",
    "__m3()\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "1uTE0rQrG-2U"
   },
   "outputs": [],
   "source": [
    "i1 = Base()     #DO NOT CHANGE THIS LINE...\n",
    "i1.m1()\n",
    "i1._m2()\n",
    "i1.__m3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "sTI_kRy5WisA"
   },
   "source": [
    "####(Q44) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n",
    "* Make sure that the final output of the commend cell should be as follows.\n",
    "```\n",
    "m1()\n",
    "_m2()\n",
    "__m3()\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "ugT86h3cElNi"
   },
   "outputs": [],
   "source": [
    "Derived.m1()\n",
    "Derived._m2()\n",
    "Derived.__m3()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ydTkWkv3Wm3t"
   },
   "source": [
    "####(Q45) Comment out errorneous statement(s) (i.e., TypeError or AttributeError). Then, if possible, correct each statement right below the commented errorneous line.\n",
    "* Make sure that the final output of the commend cell should be as follows.\n",
    "```\n",
    "m1()\n",
    "_m2()\n",
    "__m3()\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "wsYNAEWy8NDv"
   },
   "outputs": [],
   "source": [
    "i1 = Derived()      #DO NOT CHANGE THIS LINE...\n",
    "Derived.call1(i1)\n",
    "Derived.call2(i1)\n",
    "Derived.call3(i1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "2OrqARUbWtHb"
   },
   "source": [
    "####(Q46) What can replace \"Base.__init__(self)\" (in __init__(self) of Derived) with another equalivalent statement so that it can also call the Base's constructor? (i.e., replacement of \"Base.__init__(self)\" with another equivalent statement)\n",
    "\n",
    "* (YOUR ANSWER) **Comment out \"Base.init(self)\" in the code and then add another equivalent statement.**\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "QMEkjmTNJSMl"
   },
   "source": [
    "##Please refer to the code (below) for Q47 - Q48."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "ptMCnZSfJY0U"
   },
   "outputs": [],
   "source": [
    "class Student:\n",
    "\n",
    "    def __init__(self, name, level):\n",
    "        self.name = name\n",
    "        self.level = level\n",
    "\n",
    "\n",
    "s1 = Student(\"Sam Houston\", \"Graduate\")\n",
    "s2 = Student(\"Stephen F. Austin\", \"Senior\")\n",
    "s3 = Student(\"Sam Houston\", \"Graduate\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "nsk_Rp6MXmbK"
   },
   "source": [
    "####(Q47) Add a specific dunder method into Student class so that it can generate the string representation of s1 as shown below.\n",
    "```\n",
    "Name = Sam Houston, Level = Graduate\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "l13-irMPMaew"
   },
   "outputs": [],
   "source": [
    "#AFTER ADDING THE DUNDER METHOD, RUN THIS CODE CELL...\n",
    "print(s1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "MOJ27wvhYfUo"
   },
   "source": [
    "####(Q48) Implement a specific dunder method into Student class so that it can perform the equality comparison of the two instances. \n",
    "####The code cell should return the following output.\n",
    "```\n",
    "False\n",
    "True\n",
    "False\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "-RxRbEwOM3VQ"
   },
   "outputs": [],
   "source": [
    "#AFTER ADDING THE UNDER METHOD, RUN THIS CODE CELL TO SEE THE CORRECTNESS OF YOUR IMPLEMENTATION...\n",
    "print(s1 == s2)\n",
    "print(s1 == s3)\n",
    "print(s2 == s3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "rg2h_4fRZ0KA"
   },
   "source": [
    "##Refer to the skeleton of classes (below) to answer Q49 - Q50. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "H8Xe8reWZy6I"
   },
   "outputs": [],
   "source": [
    "class Polygon:\n",
    "    def get_number_of_side(self):\n",
    "        pass\n",
    "    def get_perimeter(self):\n",
    "        pass\n",
    "    def get_area(self):\n",
    "        pass\n",
    "\n",
    "class Trangle(Polygon):\n",
    "    pass\n",
    "\n",
    "class Rectangle(Polygon):\n",
    "    pass\n",
    "\n",
    "class Pentagon(Polygon):\n",
    "    pass\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "6-f7SWV0ZVZf"
   },
   "source": [
    "####(Q49) Complete the implementation of all the three methods of Polygon. After then, override the three methods for Polygon, Trangle, Rectangle, and Pentagon classes.\n",
    "* Please revise the code directly in the code cell above.\n",
    "* You are welcome to import packages if needed and add other methods as you wish."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "9PQ3stEQaHtd"
   },
   "source": [
    "####(Q50) Validate the correctness (i.e., functionality) of all the methods you implemented by demonstrating the usage of every method with at least one example for each polygon instance."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "4NFlG-jfkMwW"
   },
   "outputs": [],
   "source": [
    "#WRITE DOWN YOUR IMPLEMENTAION IN THIS CODE CELL...\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "iqO4fodscW-1"
   },
   "source": [
    "###(BONUS POINT) Any suggestions, comments, and/or thoughts?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "gRSNiWfqbXM4"
   },
   "source": [
    "##Reference\n",
    "* Please list your resource/reference information if you have any."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ohUB89-McIAX"
   },
   "source": [
    "##End of the exam"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "collapsed_sections": [
    "m37qHIlAq_UH"
   ],
   "name": "exam2_OOP_question.ipynb",
   "provenance": []
  },
  "interpreter": {
   "hash": "780a354d57c8e214d9717ce5db3cb79ec448e2663d29d7e7694b88eee37d2c96"
  },
  "kernelspec": {
   "display_name": "Python 3.10.0 64-bit",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
